<div>
    <!--部门查询页面-->
    <div class="ui top fluid attach container segment">
        <div class="ui blue top attached label">合同查询和新增</div>
        <div class="ui grid">
            <div class="row row-height-condition">
                <div class="four wide column">
                    <div class="ui small input">
                        <span class="all-condition-title">职员编号：</span>
                        <input type="text" id="staffCodeParam">
                    </div>
                </div>
                <div class="four wide column">
                    <div class="ui small input">
                        <span class="all-condition-title">职员姓名：</span>
                        <input type="text" id="staffNameParam">
                    </div>
                </div>
                <div class="eight wide column">
                    <div class="ui form">
                        <div class="two fields">
                            <div class="field">
                                <div class="ui calendar" id="startTimeParam">
                                    <span class="all-condition-title" style="font-size: 13px;">开始时间：</span>
                                    <div class="ui small input left" style="width: 177px;">
                                        <input type="text">
                                    </div>
                                </div>
                            </div>
                            <div class="field">
                                <div class="ui calendar" id="endTimeParam">
                                    <span class="all-condition-title" style="font-size: 13px;">结束时间：</span>
                                    <div class="ui small input left" style="width: 177px;">
                                        <input type="text">
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
            <div class="row row-height-condition">
                <div class="four wide column">
                    <div class="ui small input">
                        <span class="all-condition-title">合同流水：</span>
                        <input type="text" id="contractCodeParam">
                    </div>
                </div>
                <div class="four wide column">
                    <div class="ui small input">
                        <span class="all-condition-title">合同名称：</span>
                        <input type="text" id="contractNameParam">
                    </div>
                </div>
                <div class="four wide column">
                    <div class="ui small input">
                        <span class="all-condition-title">合同状态：</span>
                        <div class="ui small selection dropdown" id="account-status-dropdown-param">
                            <input type="hidden" name="accountStatusParam">
                            <i class="dropdown icon"></i>
                            <div class="default text">请选择</div>
                            <div class="menu">
                                <div class="item" data-value="-1">请选择</div>
                                <div class="item" data-value="进行中">进行中</div>
                                <div class="item" data-value="待处理">待处理</div>
                                <div class="item" data-value="已过期">已过期</div>
                            </div>
                        </div>
                    </div>
                </div>
                <div class="four wide column">
                    <div class="ui small input">
                        <span class="all-condition-title">所属部门：</span>
                        <div class="ui small selection dropdown" id="depart-dropdown-param">
                            <input type="hidden" name="departIdParam">
                            <i class="dropdown icon"></i>
                            <div class="default text">请选择</div>
                            <div class="menu">
                                <!--<div class='item' data-value='-1'>请选择</div>-->
                            </div>
                        </div>
                    </div>
                </div>
            </div>
            <div class="row row-height-condition">
                <div class="four wide column">
                    <div class="ui small input">
                        <span class="all-condition-title">合同类型：</span>
                        <div class="ui small selection dropdown" id="contract-type-dropdown-param">
                            <input type="hidden" name="contractTypeParam">
                            <i class="dropdown icon"></i>
                            <div class="default text">请选择</div>
                            <div class="menu">
                                <!--<div class='item' data-value='-1'>请选择</div>-->
                            </div>
                        </div>
                    </div>
                </div>
            </div>
            <div class="row">
                <div class="five wide column"></div>
                <div class="five wide column"></div>
                <div class="six wide column">
                    <button class="ui twitter small button all-button-between-margin" id="contact-manage-query"> 查 询
                    </button>
                    <button class="ui twitter small button all-button-between-margin" id="contact-manage-reset"> 重 置
                    </button>
                    <button class="ui twitter small button all-button-between-margin" id="contact-manage-save"> 新 增
                    </button>
                </div>
            </div>
        </div>
    </div>

    <div class="ui bottom fluid attach container segment">
        <div class="ui blue top attached label">部门查询结果</div>
        <table class="ui celled padded table" id="contractManegeTable">
            <thead>
            <tr>
                <th style="width: 12.3em;">数据操作</th>
                <th>合同流水号</th>
                <th>合同名称</th>
                <th>创建人编号</th>
                <th>创建人姓名</th>
                <th>所属部门</th>
                <th>合同类型</th>
                <th>合同状态</th>
                <th>创建时间</th>
                <th>截止日期</th>
            </tr>
            </thead>
            <tbody id="contract-manage-list">
            <tr>
                <td>
                    <span class="ui center aligned">您还没有查询呀！</span>
                </td>
            </tr>
            </tbody>
            <tfoot>
            <tr>
                <th colspan="10">
                    <div class="ui grid">
                        <div class="row">
                            <div class="ten wide column"></div>
                            <div class="six wide column">
                                <button class="ui tiny disabled twitter button" id="contract-pre-page"> 上 一 页</button>
                                <span id="currentPage"> 0 </span> / <span id="totalPage"> 0 </span>&nbsp;
                                共 <span id="totalElement"> 0 </span> 条
                                <button class="ui tiny disabled twitter button" id="contract-next-page"> 下 一 页</button>
                                <input type="number" style="width: 3.5em; height: 2em;" id="pageNumber">
                                <a href="#" id="jumpQuery"> 跳 转 </a>
                            </div>
                        </div>
                    </div>
                </th>
            </tr>
            </tfoot>
        </table>
    </div>

    <!--职员新增/修改模态框-->
    <div class="ui modal" id="contract-manage-modal">
        <div class="ui mini header title" id="contract-manage-modal-header"></div>
        <div class="scrolling content" style="height: 360px;">
            <div class="ui grid">
                <div class="row row-height-condition">
                    <div class="eight wide column">
                        <div class="ui small input">
                            <span class="all-condition-title">合同名称：</span>
                            <input type="text" id="contractName">
                        </div>
                    </div>
                </div>
                <div class="row row-height-condition">
                    <div class="eight wide column">
                        <div class="ui calendar" id="deadline">
                            <span class="all-condition-title" style="font-size: 13px;">截止时间：</span>
                            <div class="ui input">
                                <input type="text">
                            </div>
                        </div>
                    </div>
                </div>
                <div class="row row-height-condition">
                    <div class="eight wide column">
                        <div class="ui small input">
                            <span class="all-condition-title">合同类型：</span>
                            <div class="ui small selection dropdown" id="contract-type-dropdown">
                                <input type="hidden" name="contractType">
                                <i class="dropdown icon"></i>
                                <div class="default text">请选择</div>
                                <div class="menu">
                                    <!--<div class='item' data-value='-1'>请选择</div>-->
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
                <div class="row row-height-condition">
                    <div class="eight wide column">
                        <div class="ui small input">
                            <span class="all-condition-title">合同文件：</span>
                            <input type="file" id="contractFile">
                        </div>
                    </div>
                </div>
                <div class="row row-height-condition">
                    <div class="eight wide column">
                        <div class="ui small input">
                            <span class="all-condition-title">附件文件：</span>
                            <input type="file" id="annexFile">
                        </div>
                    </div>
                </div>
            </div>
        </div>
        <div class="actions">
            <button class="ui small negative button"> 取 消</button>
            <button class="ui small positive button"> 确 定</button>
        </div>
    </div>
</div>

<script>
    {
        //声明页面所需局部变量
        let pageInfo = {
            currentPage: 0,
            totalPages: 0,
            totalElement: 0
        }

        //部门信息查询
        let queryContractList = (queryParams, status) => {
            showWaitPromptBox("", "");
            $.ajax({
                url: "queryContractInfo",
                type: 'post',
                // async: false,
                data: queryParams,
                beforeSend: (request) => {
                    if (constant.csrfToken && constant.csrfHeader) {
                        request.setRequestHeader(constant.csrfHeader, constant.csrfToken);
                    }
                },
                success: (data) => {
                    $("#contract-manage-list").html("");
                    if ('0' === data.statusCode) {
                        let queryList = data.resultList;
                        let total = data.resultMap.total;
                        pageInfo.totalElement = data.resultMap.total;
                        $("#totalElement").text(pageInfo.totalElement);
                        let page = data.resultMap.pages;
                        pageInfo.totalPages = data.resultMap.pages;
                        let innerTextContractManage = "";
                        for (let i = 0; i < queryList.length; i++) {
                            innerTextContractManage +=
                                `<tr>
                                <td>
                                    <a class="modifyInfo all-button-between-margin" href="javascript:;">修改</a>
                                    <a class="download-contractFile all-button-between-margin"
                                        href= '${window.Constant.DownLoadPath}${queryList[i].fileGroupName}/${queryList[i].fileName}'
                                        download=${queryList[i].fileOriginName}>合同</a>
                                    <a class="download-annexFile all-button-between-margin"
                                        href='${window.Constant.DownLoadPath}${queryList[i].annexGroupName}/${queryList[i].annexName}'
                                        download=${queryList[i].annexOriginName}>附件</a>
                                    <a class="deleteInfo all-button-between-margin" href="javascript:;">删除</a>
                                </td>
                                <td>
                                    ${queryList[i].contractId}
                                </td>
                                <td>
                                    ${queryList[i].contractName}
                                </td>
                                <td>
                                    ${queryList[i].staffCode}
                                </td>
                                <td>
                                    ${queryList[i].staffName}
                                </td>
                                <td>
                                    ${queryList[i].departName}
                                </td>
                                <td>
                                    ${queryList[i].contractTypeName}
                                </td>
                                <td>
                                    ${queryList[i].contractStatus}
                                </td>
                                <td>
                                    ${queryList[i].createTime.replace("T", " ").substr(0, 19)}
                                </td>
                                <td>
                                    ${queryList[i].deadline.replace("T", " ").substr(0, 19)}
                                </td>
                            </tr>`
                        }
                        closeWaitPromptBox();
                        $("#contract-manage-list").html(innerTextContractManage);
                        $("#currentPage").text(pageInfo.currentPage + 1);
                        if (pageInfo.totalElement === 0) {
                            $("#currentPage").text(0);
                            $("#contract-manage-list").html(
                                `<tr>
                                <td>
                                    <span class="ui center aligned">当前暂无数据！</span>
                                </td>
                            </tr>`
                            );
                        }
                        $("#totalPage").text(page);

                        //更新按钮状态
                        if (status && pageInfo.totalElement > 10) {
                            $("#contract-next-page").removeClass("disabled")
                        }
                        if (status && pageInfo.totalElement <= 10) {
                            $("#contract-pre-page").addClass("disabled");
                            $("#contract-next-page").addClass("disabled")
                        }
                    } else if ('-1' === data.statusCode) {
                        closeWaitPromptBox();
                        showErrorPromptBox("", 2);
                    }
                },
                error: () => {
                    closeWaitPromptBox();
                    showErrorPromptBox("系统繁忙, 请稍后访问", 2);
                }
            });
        };

        $("#contact-manage-reset").click(() => {
            $("#staffCodeParam").val("");
            $("#staffNameParam").val("");
            $("#contractCodeParam").val("");
            $("#contractNameParam").val("");
            $("#startTimeParam").calendar("set date", new Date());
            $("#endTimeParam").calendar("set date", new Date());
            $("#account-status-dropdown-param").dropdown("set selected", -1);
            $("#depart-dropdown-param").dropdown("set selected", -1);
            $("#contract-type-dropdown-param").dropdown("set selected", -1);
        });

        $('#startTimeParam').calendar({
            type: 'date',
            endCalendar: $('#endTimeParam')
        });
        $('#endTimeParam').calendar({
            type: 'date',
            startCalendar: $('#startTimeParam')
        });
        // $('#deadline').calendar({
        //     type: 'date'
        // });

        $("#startTimeParam").calendar("set date", new Date());
        $("#endTimeParam").calendar("set date", new Date());
        $("#deadline").calendar("set date", new Date());
        $("#account-status-dropdown-param").dropdown();

        //职员页面下拉框数据动态加载！！！
        showWaitPromptBox("部门信息加载中...", "");
        $("#depart-dropdown-param").dropdown();
        let departParams = {
            typeData: "部门"
        }
        $.ajax({
            url: "queryAllDepartSetting",
            type: 'post',
            // async: false,
            data: departParams,
            beforeSend: (request) => {
                if (constant.csrfToken && constant.csrfHeader) {
                    request.setRequestHeader(constant.csrfHeader, constant.csrfToken);
                }
            },
            success: (data) => {
                $("#depart-dropdown-param div.menu").html("");
                if ('0' === data.statusCode) {
                    let queryList = data.resultList;
                    let innerHtmlDepartDropdown = "<div class='item' data-value='-1'>请选择</div>";
                    for (let i = 0; i < queryList.length; i++) {
                        innerHtmlDepartDropdown +=
                            `<div class="item" data-value=${queryList[i].assistInfoId}>
                                    ${queryList[i].infoName}
                                </div>`;
                    }
                    $("#depart-dropdown-param div.menu").html(innerHtmlDepartDropdown);
                    closeWaitPromptBox();
                    if (queryList.length === 0) {
                        $("#depart-dropdown-param div.default.text").text("请先设置部门信息！");
                        showErrorPromptBox("部门信息为空！请先设置", 2);
                    }
                    $("#depart-dropdown-param").dropdown("set selected", -1);
                } else if ('-1' === data.statusCode) {
                    closeWaitPromptBox();
                    showErrorPromptBox("", 2);
                }
            },
            error: () => {
                closeWaitPromptBox();
                showErrorPromptBox("系统繁忙, 请稍后访问", 2);
            }
        });

        //职员页面下拉框数据动态加载！！！
        showWaitPromptBox("合同类型信息加载中...", "");
        $("#depart-dropdown-param").dropdown();
        let contractTypeParams = {
            typeData: "类型"
        }
        $.ajax({
            url: "queryAllDepartSetting",
            type: 'post',
            // async: false,
            data: contractTypeParams,
            beforeSend: (request) => {
                if (constant.csrfToken && constant.csrfHeader) {
                    request.setRequestHeader(constant.csrfHeader, constant.csrfToken);
                }
            },
            success: (data) => {
                $("#contract-type-dropdown-param div.menu").html("");
                if ('0' === data.statusCode) {
                    let queryList = data.resultList;
                    let innerHtmlDepartDropdown = "<div class='item' data-value='-1'>请选择</div>";
                    for (let i = 0; i < queryList.length; i++) {
                        innerHtmlDepartDropdown +=
                            `<div class="item" data-value=${queryList[i].assistInfoId}>
                                    ${queryList[i].infoName}
                                </div>`;
                    }
                    $("#contract-type-dropdown-param div.menu").html(innerHtmlDepartDropdown);
                    closeWaitPromptBox();
                    if (queryList.length === 0) {
                        $("#contract-type-dropdown-param div.default.text").text("请先设置合同类型信息！");
                        showErrorPromptBox("合同类型信息为空！请先设置", 2);
                    }
                    $("#contract-type-dropdown-param").dropdown("set selected", -1);
                } else if ('-1' === data.statusCode) {
                    closeWaitPromptBox();
                    showErrorPromptBox("", 2);
                }
            },
            error: () => {
                closeWaitPromptBox();
                showErrorPromptBox("系统繁忙, 请稍后访问", 2);
            }
        });

        let contractTypeDropdownInit = () => {
            showWaitPromptBox("", "");
            $("#contract-type-dropdown").dropdown();
            let departParams = {
                typeData: "类型"
            }
            $.ajax({
                url: "queryAllDepartSetting",
                type: 'post',
                // async: false,
                data: departParams,
                beforeSend: (request) => {
                    if (constant.csrfToken && constant.csrfHeader) {
                        request.setRequestHeader(constant.csrfHeader, constant.csrfToken);
                    }
                },
                success: (data) => {
                    $("#contract-type-dropdown div.menu").html("");
                    if ('0' === data.statusCode) {
                        let queryList = data.resultList;
                        let innerHtmlDepartDropdown = "<div class='item' data-value='-1'>请选择</div>";
                        for (let i = 0; i < queryList.length; i++) {
                            innerHtmlDepartDropdown +=
                                `<div class="item" data-value=${queryList[i].assistInfoId}>
                                    ${queryList[i].infoName}
                                </div>`;
                        }
                        $("#contract-type-dropdown div.menu").html(innerHtmlDepartDropdown);
                        closeWaitPromptBox();
                        if (queryList.length === 0) {
                            $("#contract-type-dropdown div.default.text").text("请先设置部门信息！");
                            showErrorPromptBox("部门信息为空！请先设置", 2);
                            setTimeout(() => {
                                $("#staff-setting-modal").modal("hide");
                            }, 2200);
                        }
                        $("#contract-type-dropdown").dropdown("set selected", -1);
                    } else if ('-1' === data.statusCode) {
                        closeWaitPromptBox();
                        showErrorPromptBox("", 2);
                    }
                },
                error: () => {
                    closeWaitPromptBox();
                    showErrorPromptBox("系统繁忙, 请稍后访问", 2);
                }
            });
        }

        //列表查询按钮
        $("#contact-manage-query").click(() => {
            queryFunc();
        });

        //列表查询:主要为了列表自动更新
        let queryFunc = () => {
            let staffCodeParam = $("#staffCodeParam").val().trim();
            let staffNameParam = $("#staffNameParam").val().trim();
            let contractCodeParam = $("#contractCodeParam").val().trim();
            let contractNameParam = $("#contractNameParam").val().trim();
            let startTimeParam = $("#startTimeParam").calendar("get date");
            let endTimeParam = $("#endTimeParam").calendar("get date");
            let accountStatusDropdownParam = $("#account-status-dropdown-param").dropdown("get value");
            let departDropdownParam = $("#depart-dropdown-param").dropdown("get value");
            let contractTypeDropdownParam = $("#contract-type-dropdown-param").dropdown("get value");

            $("#contract-pre-page").addClass("disabled");
            $("#contract-next-page").addClass("disabled")
            pageInfo.currentPage = 0;
            let queryParams = {
                staffCodeParam: staffCodeParam,
                staffNameParam: staffNameParam,
                contractCodeParam: contractCodeParam,
                contractNameParam: contractNameParam,
                startTimeParam: startTimeParam,
                endTimeParam: endTimeParam,
                accountStatusDropdownParam: accountStatusDropdownParam,
                departDropdownParam: departDropdownParam,
                contractTypeDropdownParam: contractTypeDropdownParam,
                currentPage: pageInfo.currentPage,
                pageSize: constant.pageSize
            }
            queryContractList(queryParams, true);
        }

        //部门信息列表上一页
        $("#contract-pre-page").click(() => {
            pageInfo.currentPage = pageInfo.currentPage - 1;
            let queryParams = {
                currentPage: pageInfo.currentPage,
                pageSize: constant.pageSize
            }
            queryContractList(queryParams, false);
            if (pageInfo.currentPage <= 0) {
                $("#contract-pre-page").addClass("disabled");
            }
            if (pageInfo.currentPage <= pageInfo.totalPages + 1) {
                $("#contract-next-page").removeClass("disabled");
            }
        });

        //部门信息列表下一页
        $("#contract-next-page").click(() => {
            pageInfo.currentPage = pageInfo.currentPage + 1;
            let queryParams = {
                currentPage: pageInfo.currentPage,
                pageSize: constant.pageSize
            }
            queryContractList(queryParams, false);
            if (pageInfo.currentPage > 0) {
                $("#contract-pre-page").removeClass("disabled");
            }
            if (pageInfo.currentPage >= pageInfo.totalPages - 1) {
                $("#contract-pre-page").removeClass("disabled");
                $("#contract-next-page").addClass("disabled");
            }
        });

        //跳转到指定的页数
        $("#jumpQuery").click(() => {
            let pageNumber = $("#pageNumber").val() - 1;
            if (pageNumber === pageInfo.currentPage) {
                $("#pageNumber").val("");
                return false;
            }
            if (pageNumber < 0 || pageNumber >= pageInfo.totalPages) {
                $("#pageNumber").val("");
                showErrorPromptBox("输入的页码数有误, 请重新输入", 2);
                return false;
            }
            let queryParams = {
                currentPage: pageNumber,
                pageSize: constant.pageSize
            }
            if (queryParams.currentPage !== pageInfo.currentPage) {
                queryContractList(queryParams, false);
                pageInfo.currentPage = pageNumber;
                $("#pageNumber").val("");
            }
            if (pageNumber <= 0) {
                $("#contract-pre-page").addClass("disabled");
                $("#contract-next-page").removeClass("disabled");
            } else if (pageNumber > pageInfo.totalPages) {
                $("#contract-pre-page").removeClass("disabled");
                $("#contract-next-page").addClass("disabled");
            } else {
                $("#contract-pre-page").removeClass("disabled");
                $("#contract-next-page").removeClass("disabled");
            }
        });

        $("#contact-manage-save").click(() => {
            $("#contract-manage-modal-header").text("新增合同信息");
            contractTypeDropdownInit();
            $('#deadline').calendar({
                type: 'date'
            });
            $("#contract-manage-modal").modal({
                onApprove: function () {
                    let contractName = $("#contractName").val().trim();
                    if ("" === contractName) {
                        showErrorPromptBox("请输入当前合同的名称！", 2);
                        return false;
                    }
                    let deadline = $("#deadline").calendar("get date");
                    let contractTypeDropdownParam = $("#contract-type-dropdown").dropdown("get value");
                    if ("" === contractTypeDropdownParam || -1 === contractTypeDropdownParam) {
                        showErrorPromptBox("请选择合同的类型！", 2);
                        return false;
                    }
                    let contractFile = $("#contractFile")[0].files[0];
                    if (undefined === contractFile) {
                        showErrorPromptBox("请设置当前合同的主要文档！", 2);
                        return false;
                    }
                    if (".doc" !== contractFile.name.substr(-4) && ".docx" !== contractFile.name.substr(-5)) {
                        showErrorPromptBox("请选择doc或docx格式的文档！", 2);
                        return false;
                    }
                    let annexFile = $("#annexFile")[0].files[0];
                    if (undefined === annexFile) {
                        showErrorPromptBox("请设置当前合同需要上传的附件", 2);
                        return false;
                    }
                    if (".zip" !== annexFile.name.substr(-4)) {
                        showErrorPromptBox("请选择zip格式的附件文档！", 2);
                        return false;
                    }

                    showWaitPromptBox("合同信息保存中", "");
                    let formData = new FormData();
                    formData.append("contractName", contractName);
                    formData.append("deadline", deadline);
                    formData.append("contractTypeDropdownParam", contractTypeDropdownParam);
                    formData.append("contractFile", contractFile);
                    formData.append("annexFile", annexFile);
                    $.ajax({
                        url: "saveContractInfo",
                        type: 'post',
                        async: false,
                        data: formData,
                        processData: false, //很重要，告诉jq不要对data数据进行处理
                        contentType: false, //很重要，指定为false才能形成正确的content-type
                        beforeSend: (request) => {
                            if (constant.csrfToken && constant.csrfHeader) {
                                request.setRequestHeader(constant.csrfHeader, constant.csrfToken);
                            }
                        },
                        success: (data) => {
                            if ('0' === data.statusCode) {
                                closeWaitPromptBox();
                                showSuccessPromptBox("合同信息添加成功", 1);
                                //延迟执行列表刷新
                                setTimeout(() => {
                                    queryFunc();
                                }, 1200);
                            } else {
                                closeWaitPromptBox();
                                showErrorPromptBox("", 2);
                            }
                        },
                        error: () => {
                            closeWaitPromptBox();
                            showErrorPromptBox("系统繁忙, 请稍后访问", 2);
                        }
                    });
                    $("#contract-manage-modal").modal("hide");
                },
                onDeny: function () {

                }
            }).modal('show');
            $("#contractName").val("");
            $("#deadline").calendar("set date", new Date());
            $("#contract-type-dropdown").dropdown("set selected", -1);
            $("#contractFile").val("");
            $("#annexFile").val("");
        });

        $("#contractManegeTable").on("click", ".modifyInfo", (e) => {
            $("#contract-manage-modal-header").text("修改合同信息");
            contractTypeDropdownInit();
            $('#deadline').calendar({
                type: 'date'
            });
            $("#contract-manage-modal").modal({
                onApprove: function () {
                    let contractId = e.currentTarget.parentElement.nextElementSibling.innerText.trim();
                    let contractName = $("#contractName").val().trim();
                    if ("" === contractName) {
                        showErrorPromptBox("请输入当前合同的名称！", 2);
                        return false;
                    }
                    let deadline = $("#deadline").calendar("get date");
                    let contractTypeDropdownParam = $("#contract-type-dropdown").dropdown("get value");
                    if ("" === contractTypeDropdownParam || -1 === contractTypeDropdownParam) {
                        showErrorPromptBox("请选择合同的类型！", 2);
                        return false;
                    }
                    let contractFile = $("#contractFile")[0].files[0];
                    if (undefined === contractFile) {
                        showErrorPromptBox("请设置当前合同的主要文档！", 2);
                        return false;
                    }
                    if (".doc" !== contractFile.name.substr(-4) && ".docx" !== contractFile.name.substr(-5)) {
                        showErrorPromptBox("请选择doc或docx格式的文档！", 2);
                        return false;
                    }
                    let annexFile = $("#annexFile")[0].files[0];
                    if (undefined === annexFile) {
                        showErrorPromptBox("请设置当前合同需要上传的附件", 2);
                        return false;
                    }
                    if (".zip" !== annexFile.name.substr(-4)) {
                        showErrorPromptBox("请选择zip格式的附件文档！", 2);
                        return false;
                    }

                    let formData = new FormData();
                    formData.append("contractId", contractId);
                    formData.append("contractName", contractName);
                    formData.append("deadline", deadline);
                    formData.append("contractTypeDropdownParam", contractTypeDropdownParam);
                    formData.append("contractFile", contractFile);
                    formData.append("annexFile", annexFile);

                    showWaitPromptBox("合同信息保存中", "");
                    $.ajax({
                        url: "modifyContractInfo",
                        type: 'post',
                        async: false,
                        data: formData,
                        processData: false, //很重要，告诉jq不要对data数据进行处理
                        contentType: false, //很重要，指定为false才能形成正确的content-type
                        beforeSend: (request) => {
                            if (constant.csrfToken && constant.csrfHeader) {
                                request.setRequestHeader(constant.csrfHeader, constant.csrfToken);
                            }
                        },
                        success: (data) => {
                            if ('0' === data.statusCode) {
                                closeWaitPromptBox();
                                showSuccessPromptBox("合同信息修改成功", 1);
                                //延迟执行列表刷新
                                setTimeout(() => {
                                    queryFunc();
                                }, 1200);
                            } else {
                                closeWaitPromptBox();
                                showErrorPromptBox(data.resultMessage, 2);
                            }
                        },
                        error: () => {
                            closeWaitPromptBox();
                            showErrorPromptBox("系统繁忙, 请稍后访问", 2);
                        }
                    });
                    $("#contract-manage-modal").modal("hide");
                },
                onDeny: function () {

                }
            }).modal('show');
            $("#contractName").val("");
            $("#deadline").calendar("set date", new Date());
            $("#contract-type-dropdown").dropdown("set selected", -1);
            $("#contractFile").val("");
            $("#annexFile").val("");
        });

        $("#contractManegeTable").on("click", ".deleteInfo", (e) => {
            $("#delete-list-modal").modal({
                onApprove: function () {
                    let contractId = e.currentTarget.parentElement.nextElementSibling.innerText.trim();
                    let queryParams = {
                        contractId: contractId
                    }
                    $.ajax({
                        url: "deleteContractInfo",
                        type: 'post',
                        data: queryParams,
                        beforeSend: (request) => {
                            if (constant.csrfToken && constant.csrfHeader) {
                                request.setRequestHeader(constant.csrfHeader, constant.csrfToken);
                            }
                        },
                        success: (data) => {
                            if ('0' === data.statusCode) {
                                closeWaitPromptBox();
                                showSuccessPromptBox("合同信息删除成功", 1);
                                //延迟执行列表刷新
                                setTimeout(() => {
                                    queryFunc();
                                }, 1200);
                            } else if ('-1' === data.statusCode) {
                                closeWaitPromptBox();
                                showErrorPromptBox("", 2);
                            }
                        },
                        error: () => {
                            closeWaitPromptBox();
                            showErrorPromptBox("系统繁忙, 请稍后访问", 2);
                        }
                    });
                    $("#delete-list-modal").modal("hide");
                },
                onDeny: function () {

                }
            }).modal('show');
        });
    }
</script>